INC_HOME = /usr/local/include/
INC = -I /lib/sqlite -I /usr/local/include -I /usr/local/include/modbus -I /usr/include/
# INC += -I$(INC_HOME)/iec60870/inc/api
# INC += -I$(INC_HOME)/iec60870/hal/inc
# INC += -I$(INC_HOME)/iec60870/tls
INC += -I$(INC_HOME)/lib60870/ -I ./dlt645_inc/ -I ./dlt645_port/
#每一个路径的前面都要加上-I，并且需注意加上“/”,尤其是像usr这类顶级的目录
LIB = -L /usr/local/lib  -L ./
BIN = opc
#SRC_DIR = ./
# SRC:= $(shell find $(SRC_DIR) -name '*.c')
# OBJS = $(SRC:.c=.o)
SRC=$(wildcard *.c)
OBJS = $(SRC:.c=.o)
#$(BIN):minimal_example.o open62541.o http_function.c opc_fun.c dlt645.o
#	gcc -g -o $(BIN) minimal_example.o open62541.o http_function.c  dlt645.o opc_fun.c -lmicrohttpd -lmodbus -pthread -l sqlite3
#带上C99标准以后，这种编译方式指令就是错误的写法
#在开发板上面编译的时候，需要在链接的时候带上-lgnutls，否则http引入ssl会失败
$(BIN):$(OBJS)
	gcc -g -o $(BIN) $(OBJS) -lmicrohttpd -lmodbus -pthread -lsqlite3 \
	-lopen62541 -lcjson -llib60870 -lssl -lcrypto -lgnutls -lm	\
	-lcurl
%.o:%.c
	gcc -g -o $@ -c	$(filter %.c,$^) $(INC) $(LIB)
clean:
	rm -f $(BIN) $(OBJS)
#	3319590549@qq.com
#	zyl210727
# dlt645.o:dlt645_api_07.c
# 	gcc -g -c dlt645_api_07.c -o dlt645_api_07.o
# open62541.o:open62541.c
# 	gcc -g -c open62541.c -o open62541.o
# minimal_example.o:minimal_example.c
# 	gcc -g -c minimal_example.c -o minimal_example.o
# http_function.o:http_function.c
# 	gcc -g -c http_function.c -o http_function.o
# opc_fun.o:opc_fun.c
# 	gcc -g -c opc_fun.c -o opc_fun.o

